package netty.test5ZeroCopy;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 传统io的服务器端
 */
public class OldServer {
    public static void main(String[] args) throws IOException {
        ServerSocket server=new ServerSocket(7002);
        while (true){
            Socket socket=server.accept();
            DataInputStream in=new DataInputStream(socket.getInputStream());

            try {
                byte [] byteArray=new byte[4096];
                while (true){
                    int readCount=in.read(byteArray,0,byteArray.length);
                    if(-1==readCount){
                        break;
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
